package com.chap4;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * <code>MyThreadLocal</code>
 * </p>
 *
 * @author junbao3
 * TODO
 * @date 2023-03-28 8:07
 * Copyright (C) 2021 IFlyTek. All rights reserved.
 */
public class MyThreadLocal<T> {
    private Map<Thread,T> threadTMap = new HashMap<>();

    public synchronized T get(){
        return  threadTMap.get(Thread.currentThread());
    }

    public synchronized void set(T t){
        threadTMap.put(Thread.currentThread(),t);
    }

}
